


import java.util.Stack;


public class Foundation{
	private Stack<Card> foundation;
	
	public Foundation(){
		foundation = new Stack<Card>();
	}
	public boolean add(Card c){
		if(foundation.isEmpty() && c.getValue() == 1){
			foundation.push(c);
			return true;
		}
		if(foundation.isEmpty())
			return false;
		if((foundation.peek().getSuite() == c.getSuite()) && (foundation.peek().getValue() + 1 == c.getValue())){
			foundation.push(c);
			return true;
		}
		return false;
	}
	public Card get(){
		if(foundation.size() > 0)
			return foundation.peek();
		return null;
	}
}
